package com.davidhigenbottam.HeatMap.server;

import com.davidhigenbottam.HeatMap.data.GrossEnrollmentRatioProvinceData;
import com.davidhigenbottam.HeatMap.data.HigherEducationEnrolementInstitutionData;
import com.davidhigenbottam.HeatMap.data.HigherEducationEnrolementProvinceData;
import com.davidhigenbottam.HeatMap.data.InstitutionData;
import com.davidhigenbottam.HeatMap.data.NetEnrollmentRatioProvinceData;
import com.davidhigenbottam.HeatMap.data.ProvinceData;
import com.davidhigenbottam.HeatMap.data.SchoolEnrollmentRatioProvinceData;
import com.davidhigenbottam.HeatMap.data.StaffWithPhdInstitutionData;
import com.davidhigenbottam.HeatMap.data.StaffWithPhdProvinceData;
import com.davidhigenbottam.HeatMap.shared.Query;

public class DataFactory {

	
	
	
	public static ProvinceData createProvinceData(Query query){
		ProvinceData provinceData;
		if(query.isHEEnrolement())
			provinceData = new HigherEducationEnrolementProvinceData(query);
		else if(query.isStaffWithPhd())
			provinceData = new StaffWithPhdProvinceData(query);
		else if(query.isSchoolEnrollmentRatio())
			provinceData = new SchoolEnrollmentRatioProvinceData(query);
		else if(query.isGrossEnrollmentRatio())
			provinceData = new GrossEnrollmentRatioProvinceData(query);
		else if(query.isNetEnrollmentRatio())
			provinceData = new NetEnrollmentRatioProvinceData(query);
		else
			throw new RuntimeException("Undefined data source");
		
		return provinceData;
	}
	public static InstitutionData createInstitutionData(Query query){
		InstitutionData data= null;
		if(query.isHEEnrolement())
			data = new HigherEducationEnrolementInstitutionData(query);
		else if(query.isStaffWithPhd())
			data = new StaffWithPhdInstitutionData(query);
//		else if(query.isSchoolEnrollmentRatio())
//			provinceData = new SchoolEnrollmentRatioProvinceData(query,localMode);
//		else if(query.isGrossEnrollmentRatio())
//			provinceData = new GrossEnrollmentRatioProvinceData(query,localMode);
//		else if(query.isNetEnrollmentRatio())
//			provinceData = new NetEnrollmentRatioProvinceData(query,localMode);
		else
			data= null;
		
		return data;
	}
}
